<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>事件的基本使用</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="root">
    <h1>欢迎来到{{ name }}学习</h1>
    <!-- <button v-on:click="showInfo">点我提示信息</button> -->
    <button @click="showInfo1">点我提示信息1</button>
    <button @click="showInfo2($event, 66)">点我提示信息2</button>
  </div>

  <script>
    Vue.config.productionTip = false;

    new Vue({
      el: '#root',
      data: {
        name: '尚硅谷'
      },
      methods: {
        showInfo1(event) {
          // console.log(event.target.innerText)
          // console.log(this) // 此处的this是vm
          alert('同学你好！')
        },
        showInfo2(event, num) {
          console.log(event)
          console.log(num)
          // alert('同学你好！！')
        }
      }
    })
  </script>
</body>

</html>